<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport"
          content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta name="keywords"
          content="Web前端视频教程,大数据视频教程,HTML5视频教程,UI视频教程,PHP视频教程,java视频教程,python基础教程">
    <meta name="description"
          content="智游教育在线课程视频,为您提供java,python,HTML5,UI,PHP,大数据等学科经典视频教程在线浏览学习,精细化知识点解析,深入浅出,想学不会都难,智游教育,学习成就梦想！">
    <%@include file="/before/include/style.html" %>
    <title>在线公开课-智游教育|java|大数据|HTML5|python|UI|PHP视频教程</title>
</head>
<body class="w100">
<jsp:include page="/before/include/header.jsp"></jsp:include>
<div>
    <!--面包屑导航-->
    <div class="container mian-nav" id="thisCourseName">公开课 /</div>
    <input type="hidden" id="videoId" value="${videoId}">
    <div id="content">
        <jsp:include page="/before/video/beforeVideoContent.jsp"></jsp:include>
    </div>
</div>

<%@ include file="/before/include/footer.jsp" %>

<%--<%@ include file="/before/include/script.html" %>--%>
<script src="/static/js/video.js"></script>
<script src="/static/js/jquery.js"></script>
<script>
    function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
    }

    let courseId = 0;
    let names  = {};
    $(function () {
        $.ajax({
            url: "/video/" + GetQueryString("id"),
            type: "POST",
            success: function (data) {
                $("#thisTitle").text(data.data[0].title);
                $("#thisDetail").append(data.data[0].detail);
                $("#thisVideoUrl").attr("src", data.data[0].videoUrl);
                $.each(data.data[1], function (index, obj) {
                    if (obj.id === data.data[0].spearkerId || obj.id == data.data[0].spearkerId) {
                        $("#thisImageUrl").css("background-image", "url('" + obj.headImgUrl + "')");
                        $("#thisSpeakerDesc").text(obj.speakerDesc);
                        $("#thisSpeakerName").text("讲师 : " + obj.speakerName);
                    }
                });
                names = data.data[1];
                $.each(data.data[2], function (index, obj) {
                    if (obj.id === data.data[0].courseId || obj.id == data.data[0].courseId) {
                        $("#thisCourseDesc").text(obj.courseDesc);
                        $("#thisCourseName").text(obj.courseTitle);
                        courseId = obj.id;
                    }
                });
               other();
            }
        });

    });
    function other() {
        $.ajax({
            url:"/video/courseId/"+courseId,
            type:"GET",
            success : function (data) {
                $.each(data.data,function (index,video) {
                    $("#other").append(" <div class=\"chapter\" onclick='otherJsp("+video.id+")'><p class=\"biaoti\" ><a href=\"/before/video/beforeVideoIndex.jsp?id="+video.id+"\">"+video.title+"</a></p>" +
                        "<p class=\"lecturer\" >"+video.detail+"</p><p class=\"lecturer\" id='otherSpeakerName'></p>" +
                        "<div class=\"v-info\"><span class=\"count\" ><img src=\"/static/img/count.png\" alt=\"\">"+video.playNum+"</span>" +
                        "<span class=\"duration\"><img src=\"/static/img/player.png\" alt=\"\">"+video.time+"</span> </div></div>");
                    $.each(names,function (index,obj) {
                        if(obj.id == video.spearkerId||obj.id === video.spearkerId){
                            $("#otherSpeakerName").text(obj.speakerName);
                            $("#otherSpeakerName").removeAttr("id");
                        }
                    })
                });

            }
        });
    }
    function otherJsp(id) {
        window.location ="/before/video/beforeVideoIndex.jsp?id="+id;
    }
    $(function () {
        let email = "${user.email}";
        if (email != null & email !== "") {
            $("#userBlock").css("display", "inline-block");
            $("#regBlock").css("display", "none");
        }
    })
</script>
</body>
</html>
